﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>自动发起</title>

    <link href="../../Scripts/CodeMirror/lib/codemirror.css" rel="stylesheet" />
    <link href="../../Scripts/CodeMirror/addon/hint/show-hint.css" rel="stylesheet" />
    <script src="../../Scripts/CodeMirror/lib/codemirror.js"></script>
    <script src="../../Scripts/CodeMirror/addon/edit/matchbrackets.js"></script>
    <script src="../../Scripts/CodeMirror/mode/sql/sql.js"></script>
    <script src="../../Scripts/CodeMirror/addon/hint/show-hint.js"></script>
    <script src="../../Scripts/CodeMirror/addon/hint/sql-hint.js"></script>
    <script src="../../LoadSql.js"></script>
    <link href="../../Scripts/easyUI145/themes/color.css" rel="stylesheet" />
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/easyUI145/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/easyUI145/themes/icon.css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="../../Scripts/easyUI145/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../Scripts/easyUI145/locale/easyui-lang-zh_CN.js"></script>
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script src="../Admin.js"></script>
    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            $("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");

            //初始化groupID.
            var fk_flow = GetQueryString("FK_Flow");
            var flow = new Entity("BP.WF.Flow", fk_flow);

            //通用赋值控件.
            GenerFullAllCtrlsVal(flow);

            //设置选择按钮选中.
            if (flow.FlowRunWay == 1)
                document.getElementById("TB_SpecEmp").value = flow.RunObj;

            if (flow.FlowRunWay == 2)
                document.getElementById("TB_SQL").value = flow.RunObj;

            $("#Msg").html("");
        });

        function Save() {

            $("#Msg").html("正在保存,请稍后......");

            var fk_flow = GetQueryString("FK_Flow");
            var flow = new Entity("BP.WF.Flow", fk_flow);

            var val = $('input[name="RB_FlowRunWay"]:checked').val();

            flow.FlowRunWay = val;
            if (flow.FlowRunWay == "1") {
                flow.RunObj = $("#TB_SpecEmp").val();
            }

            if (flow.FlowRunWay == "2") {
                flow.RunObj = $("#TB_SQL").val();
            }
            flow.Update();

            window.location.href = window.location.href;

        }
    </script>
    <style type="text/css">
        /*body.easyui-layout {
            top: 20px;
            left: 40px;
        }*/
        .panel-body {
            padding: 0px;
        }

        .tabs {
            border-width: 1px 0 1px 0;
        }

        .btn-default {
            border: 0px;
        }

        .cs-btn-group {
            width: auto !important;
            min-height: 34px;
            text-align: right;
            background-color: transparent;
        }

            .cs-btn-group .l-btn-icon {
                display: none;
            }

            .cs-btn-group .l-btn-text {
                margin: 0;
            }

        .layout-panel {
            position: absolute;
            right: 0;
            top: 0 !important;
            box-shadow: none;
        }

        .layout-panel-north {
            width: auto !important;
            left: auto !important;
            background-color: transparent;
        }

        .btn {
            padding: 0 10px;
            color: #fff !important;
            border-radius: 0px !important;
            border: 0;
            height: 24px;
            line-height: 24px;
            box-sizing: border-box;
        }

            .btn:hover {
                padding: 0 10px;
                border: 0;
            }

        .btn-light-green {
            background-color: #50b6ac !important;
        }

            .btn-light-green:hover {
                background-color: #50b6ac;
            }

        .btn-light-blue {
            background-color: #62cae3 !important;
        }

            .btn-light-blue:hover {
                background-color: #62cae3;
            }

        .btn-light-yellow {
            background-color: #f3ba20 !important;
        }

            .btn-light-yellow:hover {
                background-color: #f3ba20;
            }

        .btn-light-red {
            background-color: #f74f52 !important;
        }

            .btn-light-red:hover {
                background-color: #f74f52;
            }

        .btn-white {
            border: 1px solid #031f5d;
            background-color: #fff !important;
            ;
            color: #031f5d !important;
        }

            .btn-white:hover {
                border: 1px solid #031f5d;
            }

        .tabs-wrap .tabs, .tabs-panels, .tabs li a.tabs-inner, .tabs-panels table, td.FDesc, td.FContext, td {
            border: 0;
        }

        .tabs-wrap table {
            width: 100% !important;
        }

        .tabs-wrap .tabs {
            padding-left: 0;
            width: auto;
            border-bottom: 1px solid #0a2561;
        }

        .tabs li a.tabs-inner {
            padding: 0 16px;
            background: none;
            border-radius: 5px 5px 0 0;
        }

            .tabs li a.tabs-inner:hover {
                background: none;
                font-weight: bold;
            }

        .tabs li.tabs-selected a.tabs-inner {
            border: 1px solid #0a2561;
            border-bottom-color: #fff;
            background: #fff;
        }

        td {
            box-sizing: border-box;
        }

            td a {
                color: #15398b;
                font-size: 12px;
            }

                td a img {
                    vertical-align: -2px;
                }

            td.FContext {
                width: 30%;
            }

                td.FContext:nth-child(2) {
                    padding-right: 30px;
                }

                td.FContext > *:only-child {
                    width: 100% !important;
                    font-size: 13px;
                    color: #282828;
                    box-sizing: border-box;
                }

                td.FContext[colspan] {
                    padding-right: 0;
                }

        select[disabled], input[type=text]:disabled, .form-control, .form-control[disabled], .form-control[readonly], fieldset[disabled] {
            background-color: #fff;
            border: 1px solid #ccc !important;
            text-align: left !important;
            height: 32px;
            box-sizing: border-box;
        }

            select[disabled], input[type=text]:disabled, .form-control[disabled], .form-control[readonly], fieldset[disabled] {
                background-color: #f7f6f9;
            }

        td input[type="text"], td input[type="number"], td input[type="date"], td input[type="tel"] {
            height: 32px;
        }

        td input[type="checkbox"] {
            margin-right: 5px;
            width: 16px;
            height: 16px;
        }

        td label {
            font-size: 13px;
        }

        /*td.FDesc {
           padding-right: 10px;
            text-align: right;
            box-sizing: border-box;
        }*/
        /*td.FDesc:first-child {
            width: 81px!important;
        }
        td:nth-child(3)[class="FDesc"] {
            width: 130px!important;
        }*/
        .cs-form-import > .layout-panel-center {
            padding: 16px 0 0 16px;
        }

        .cs-form-import > .layout-panel-north {
            top: 6px !important;
            padding-right: 21px;
            border-radius: 0;
        }
    </style>
</head>
<body>
 <form id="cc">
     
     <div id="bar" class="cs-tr cs-bar">
         <label style="float:left;font-size:14px;font-weight:bolder;padding-top:10px;">自动发起</label>
         <input type="button" id="Btn_Save" runat="server" value="保存" onclick="Save()" />

     </div>
     
                <fieldset>
                    <legend id="help"></legend>
                    <ul>
                    <li> 定义：自动启动工作流程，一个流程的开始节点的填写与发起是在特定规则的设置下自动发起的流程。</li>
                    <li> 解释：通常模式下的流程启动是手工的启动，就是用户从一个发起列表，点击流程名字，就启动了该流程。但是有的时候，是系统自动发起该流程。</li>

                        <li>应用场景</li>
                        <li> 1 周例会流程，用户希望每个周都要启动例会通知流程这个启动是让系统自动发起而非人工发起。</li>


                    </ul>
                </fieldset>

                <fieldset>
                    <legend>
                    <input id="RB_FlowRunWay_0" type="radio" name="RB_FlowRunWay" value="0"  /><label for="RB_FlowRunWay_0">手工启动（默认）</label>
                    </legend>

                        <ul>
                        <li>
                     <font color="gray">说明：就是说工作人员从流程发起列表里，点流程，就发起流程。</font>
                     </li>
                     </ul> 
                </fieldset>
                <fieldset>
                    <legend>
                        <input id="RB_FlowRunWay_1" type="radio" name="RB_FlowRunWay" value="1" /><label for="RB_FlowRunWay_1">指定人员按时启动</label>
                    </legend>
                    <br />
                    <a href="javascript:ShowHidden('emps')">操作员参数设置帮助:</a>

                    <div id="emps" style=" display:none;color:Gray">
                        <ul>
                            <li>说明：指定的人员指定的发起时间点自动启动流程。</li>
                            <li>请打开操作手册：<a href="javascript:WinOpen('http://ccbpm.mydoc.io/?v=5404&t=17088')">操作手册</a></li>
                            <li>一个人启动的参数格式：人员编号@时间点1@时间点2@时间点n  </li>

                            <li>n个人启动的参数格式：人员编号@时间点1@时间点2@时间点n,人员编号@时间点1@时间点2@时间点n,人员编号@时间点1@时间点2@时间点n</li>
                            <li>比如：zhangshan@01:01@12:01  让张三在每天的 1点零1分，与12点零1分发起此流程。</li>
                            <li>比如：zhangshan@-01 01:01  让张三在每月1号的1点零1分发起此流程。</li>
                            <li>比如：zhangshan@06-01 01:01  让张三在每年的6月1号的1点零1分发起此流程。</li>
                            <li>cc的日期格式为：yyyy-MM-dd HH:mm 如果时间匹配到您设置的时间点，那么系统就会触发流程，多个时间点用@符号隔开。</li>
                        </ul>
                    </div>

                    <br />

                    <input type="text" style="width:95%" id="TB_SpecEmp" name="TB_SpecEmp" />
                </fieldset>

                <fieldset>
                    <legend>

                        <input id="RB_FlowRunWay_2" type="radio" name="RB_FlowRunWay" value="2" /><label for="RB_FlowRunWay_2">数据集按时启动</label>

                    </legend>
                    <br />

                    <a href="javascript:ShowHidden('sql')">SQL参数设置帮助:</a>
                    <div id="sql" style=" display:none;color:Gray">
                        <ul>
                            <li>请设置一个SQL语句，该语句返回一个数据源。</li>
                            <li>系统就会对每一条数据发起一条流程，这就是按照数据源的模式自动发起流程。</li>
                            <li>该数据源的列名如果与开始节点表单的字段名一致，就会自动赋值。</li>
                            <li>该参数支持ccbpm的表达式。比如:@WebUser.No,@WebUser.Name,@WebUser.FK_Dept,@WebUser.OrgNo</li>
                            <li>请打开操作手册：<a href="javascript:WinOpen('http://ccbpm.mydoc.io/?v=5404&t=17088')">操作手册</a></li>
                        </ul>
                    </div>
                    <br />

                    <textarea type=text style="width:95%" id="TB_SQL" name="TB_SQL" ></textarea>
                </fieldset>

                <fieldset>
                    <legend>

                    <input id="RB_FlowRunWay_3" type="radio" name="RB_FlowRunWay" value="3"  /><label for="RB_FlowRunWay_3">触发式启动</label>
                    </legend>
                     
                        <ul style="color:Gray">
                        <li>说明:第三方软件向特定的表 WF_Task 中写入数据，每写入一条数据系统就会自动发起一条流程。</li>
                        <li>ccBPM就会读取这张表来完成流程的发起，发起成功后就把这条记录设置成已经发起的状态。</li>
                        <li>详见设置以及该表的结构参考<a href="javascript:WinOpen('http://ccbpm.mydoc.io/?v=5404&t=17088')">操作手册</a></li>
                        </ul>
                    <font color="gray">
                    </font>                 
                </fieldset>

                <!--<input type=button value="保存" onclick="Save();" />-->
               <!--<asp:Button  class="easyui-linkbutton" ID="Btn_Save" runat="server" Text="保存" OnClick="BtnSave_Click" /> --> 
              
<!--
                <a style=" float:right" href="javascript: if ( confirm('您确定要执行吗? 注意:对于数据量交大的数据因为web上执行时间的限时问题，会造成执行失败。') ) { WinOpen('/WF/Comm/RefMethod.htm?Index=7&EnsName=BP.WF.Template.FlowSheets&No=<%=FK_Flow %>&r=1208095548','_blank') }" tooltip="">手动启用定时任务</a>
-->


<div id="Msg"> </div>

</form>
</body>
</html>
